<html>
 <head>
  <link href="./leetcode-problem.css" rel="stylesheet" type="text/css">
 </head>
 <body>
  <div class="question_difficulty">
   难度：Medium
  </div>
  <div>
   <h1 class="question_title">
    139. Word Break
   </h1>
   <p>
    Given a
    <strong>
     non-empty
    </strong>
    string
    <em>
     s
    </em>
    and a dictionary
    <em>
     wordDict
    </em>
    containing a list of
    <strong>
     non-empty
    </strong>
    words, determine if
    <em>
     s
    </em>
    can be segmented into a space-separated sequence of one or more dictionary words.
   </p>
   <p>
    <strong>
     Note:
    </strong>
   </p>
   <ul>
    <li>
     The same word in the dictionary may be reused multiple times in the segmentation.
    </li>
    <li>
     You may assume the dictionary does not contain duplicate words.
    </li>
   </ul>
   <p>
    <strong>
     Example 1:
    </strong>
   </p>
   <pre>
<strong>Input:</strong> s = "leetcode", wordDict = ["leet", "code"]
<strong>Output:</strong> true
<strong>Explanation:</strong> Return true because <code>"leetcode"</code> can be segmented as <code>"leet code"</code>.
</pre>
   <p>
    <strong>
     Example 2:
    </strong>
   </p>
   <pre>
<strong>Input:</strong> s = "applepenapple", wordDict = ["apple", "pen"]
<strong>Output:</strong> true
<strong>Explanation:</strong> Return true because <code>"</code>applepenapple<code>"</code> can be segmented as <code>"</code>apple pen apple<code>"</code>.
&nbsp;            Note that you are allowed to reuse a dictionary word.
</pre>
   <p>
    <strong>
     Example 3:
    </strong>
   </p>
   <pre>
<strong>Input:</strong> s = "catsandog", wordDict = ["cats", "dog", "sand", "and", "cat"]
<strong>Output:</strong> false
</pre>
  </div>
  <div>
   <h1 class="question_title">
    139. 单词拆分
   </h1>
   <p>
    给定一个
    <strong>
     非空
    </strong>
    字符串
    <em>
     s
    </em>
    和一个包含
    <strong>
     非空
    </strong>
    单词列表的字典
    <em>
     wordDict
    </em>
    ，判定&nbsp;
    <em>
     s
    </em>
    是否可以被空格拆分为一个或多个在字典中出现的单词。
   </p>
   <p>
    <strong>
     说明：
    </strong>
   </p>
   <ul>
    <li>
     拆分时可以重复使用字典中的单词。
    </li>
    <li>
     你可以假设字典中没有重复的单词。
    </li>
   </ul>
   <p>
    <strong>
     示例 1：
    </strong>
   </p>
   <pre><strong>输入:</strong> s = "leetcode", wordDict = ["leet", "code"]
<strong>输出:</strong> true
<strong>解释:</strong> 返回 true 因为 "leetcode" 可以被拆分成 "leet code"。
</pre>
   <p>
    <strong>
     示例 2：
    </strong>
   </p>
   <pre><strong>输入:</strong> s = "applepenapple", wordDict = ["apple", "pen"]
<strong>输出:</strong> true
<strong>解释:</strong> 返回 true 因为 <code>"</code>applepenapple<code>"</code> 可以被拆分成 <code>"</code>apple pen apple<code>"</code>。
&nbsp;    注意你可以重复使用字典中的单词。
</pre>
   <p>
    <strong>
     示例 3：
    </strong>
   </p>
   <pre><strong>输入:</strong> s = "catsandog", wordDict = ["cats", "dog", "sand", "and", "cat"]
<strong>输出:</strong> false
</pre>
  </div>
 </body>
</html>